<template>
	<view>
		<view class="item"
			@click="$pub.go(`/pages/articleDetail/articleDetail?data=${encodeURIComponent(JSON.stringify(newData))}`)">
			<view class="title text-ellipsis">
				{{newData.title}}
			</view>
			<view class="content flex-row">
				<view class="info">
					<view class="summary">
						{{newData.digest || '暂无'}}
					</view>
					<view class="flex-row">
						<text class="date">
							{{newData.ptime}}
						</text>
						<text class="views">{{newData.commentCount}}阅读</text>
						<text class="views">{{newData.source}}</text>
					</view>
				</view>
				<view class="cover">
					<image class="img" :src=" newData.imgsrc || ' https://cdn.uviewui.com/uview/resources/codeFun.jpg'">
					</image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "card",
		data() {
			return {

			};
		},
		props: {
			newData: {
				type: Object,
				default: {}
			}
		},

	}
</script>


<style lang="scss" scoped>
	.item {
		padding: 30rpx;
		// margin-bottom: 30rpx;
		background-color: #FFF;

		.title {
			font-weight: bold;
			padding-bottom: 30rpx;
			border-bottom: 2rpx solid #F5F5F5;
		}

		.content {
			padding-top: 30rpx;
			align-items: flex-start;

			.info {
				width: calc(100% - 160rpx);

				.summary {
					color: #777;
					height: 80rpx;
					font-size: 24rpx;
					line-height: 1.6;
					margin-bottom: 10rpx;
					@include text-ellipsis(2);
				}

				.date {
					font-size: 24rpx;
					color: $main-color;
					opacity: 0.6;
				}

				.views {
					color: #999;
					font-size: 24rpx;
				}
			}

			.cover {
				width: 140rpx;
				height: 120rpx;

				.img {
					width: 100%;
					height: 100%;
					border-radius: 4rpx;
				}
			}
		}
	}
</style>